<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    //简单数据类型
    let num1 = 10;
    let num2 = num1;
    num2 = 20;
    console.log(num1); //10  因为是简单数据类型属于浅拷贝 只在栈里面直接存储数据
    //复杂数据类型
    let obj1 = {
      num: 10
    }
    let obj2 = obj1;
    obj2.num = 20;
    console.log(obj1.num);//20 因为是复杂数据类型属于深拷贝 只在栈里面存储地址，值是放在堆里面的

  </script>
</body>

</html>